#include "napi/native_api.h"
#include <cstring>
#include <js_native_api_types.h>
#include <node_api.h>
#include <string>

static std::string napi_utils_get_string(napi_env env, napi_value target) {
    size_t len = 0;
    napi_get_value_string_utf8(env, target, nullptr, 0, &len);
    std::string str(len, '\0');
    napi_get_value_string_utf8(env, target, &str[0], len + 1, &len);
    return str;
}